import Vue from 'vue'
import App from './App'

// vuex
import store from './store'

// 引入全局uView
import uView from '@/uview-ui'

import mixin from './common/mixin'

Vue.prototype.$moment = require('moment')

Vue.prototype.$store = store

Vue.config.productionTip = false

App.mpType = 'app'
Vue.use(uView)

// #ifdef MP
// 引入uView对小程序分享的mixin封装
const mpShare = require('@/uview-ui/libs/mixin/mpShare.js')
Vue.mixin(mpShare)
// #endif

Vue.mixin(mixin)


// 全局过滤
Vue.filter('phone', (e) => {
	let str = '';
	if (e) {
		let reg = /(\d{3})\d{4}(\d{4})/;
		str = e.replace(reg, "$1****$2")
	}
	return str
});
Vue.filter('str', (e) => {
	let str = '';
	if (e) {
		let reg = /(\d{5})\d{8}(\d{4})/;
		str = e.replace(reg, "$1******$2")
	}
	return str
});

const app = new Vue({
	store,
	...App
})

// 引入请求封装
require('./util/request/index')(app)

app.$mount()
